package com.gsh.dao;

import com.gsh.pojo.Electricity;
import com.gsh.pojo.Voltage;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * 电流表的Dao
 */
@Mapper
@Repository
public interface ElectricityDao {

    //插入数据
    @Insert("insert into tb_electricity(UID,IDate,LDate,MeasuringPoint,ErrType,IMoment,IDataValue,Capacity,FOM) " +
            "values(#{uid},#{iDate},#{lDate},#{measuringPoint},#{errType},#{iMoment},#{iDataValue},#{capacity},#{fom})")
    int insertElectricity(Electricity electricity);

    //批量插入,xml
    int insertBatchElectricity(List<Electricity> electricity);

    //查询，按测量点名称，起始日期和截止日期查询数据
    @Select("select * from tb_electricity where MeasuringPoint=#{measuringPoint} and ErrType=#{errType} and IDate between #{beginDate} and #{endDate} order by IMoment asc")
    List<Electricity> querybyMD(String measuringPoint,int errType, Date beginDate, Date endDate);
}
